<?php
namespace App\Api\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use App\Models\MemberUser;

// 用户
class MemberUserController extends BaseApiController
{

    public function __construct()
        {
            parent::__construct(new MemberUser());
        }

        /**
         * @desc 数据校验证规则
         * @param string $action 操作类型（store 创建数据，update 更新数据）
         * @return array
         */
        protected function getValidationRules(string $action): array
        {
            return [
                       'store' => [
                           [
                               'username' => 'required',
                               'password' => 'required',
                               'avatar' => 'required',
                           ],
                           [
                               'username.required' => '用户名不能为空',
                               'password.required' => '密码不能为空',
                           ]
                       ],
                       'update' => [],
                   ][$action] ?? [];
        }

}
